package com.binarysoft.service.common.quartz;

import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;

import common.framework.dsb.DynamicService;

public interface QuartzService extends DynamicService {
	String JOB_ID = "JOB_ID";

	/**
	 * Schedule job
	 * 
	 * @param jobClass
	 * @param cronExpression
	 * @return job ID
	 * @throws SchedulerException
	 */
	long scheduleJob(Class<? extends Job> jobClass, String cronExpression) throws Exception;

	/**
	 * Schedule job
	 * 
	 * @param jobDetail
	 * @param trigger
	 * @throws SchedulerException
	 */
	void scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException;

	/**
	 * Get SchedulerFactory
	 * 
	 * @return
	 */
	SchedulerFactory getSchedulerFactory();

	/**
	 * Get Scheduler
	 * 
	 * @return
	 */
	Scheduler getScheduler();

}
